# config/event_configs.py
from typing import Dict, List
import random

class EventConfigs:
    """事件配置"""
    
    @staticmethod
    def get_world_events() -> List[Dict]:
        """获取世界事件配置"""
        return [
            {
                "name": "天空泰坦讨伐",
                "type": "titan_battle",
                "trigger_conditions": {
                    "min_cycle": 5,
                    "required_factors": 3,
                    "min_average_level": 10
                },
                "rewards": {
                    "health_bonus": 100,
                    "healing_bonus": 50,
                    "special_buff": "titan_slayer"
                },
                "difficulty": "hard"
            },
            {
                "name": "神秘商人",
                "type": "merchant", 
                "trigger_conditions": {
                    "random_chance": 0.3,
                    "max_concurrent": 1
                },
                "rewards": {
                    "items": ["治疗药水", "力量药剂", "速度之靴"],
                    "gold": 100
                },
                "difficulty": "easy"
            },
            {
                "name": "古代遗迹",
                "type": "exploration",
                "trigger_conditions": {
                    "min_cycle": 3,
                    "random_chance": 0.2
                },
                "rewards": {
                    "experience": 200,
                    "attribute_boost": {"perception": 10}
                },
                "difficulty": "medium"
            }
        ]
    
    @staticmethod
    def get_random_event() -> Dict:
        """获取随机事件"""
        events = EventConfigs.get_world_events()
        return random.choice(events)
    
    @staticmethod
    def get_event_by_type(event_type: str) -> Dict:
        """根据类型获取事件"""
        events = EventConfigs.get_world_events()
        for event in events:
            if event["type"] == event_type:
                return event
        return {}